<%@ include file="/common/taglibs.jsp"%>

<head>
    <title><fmt:message key="lawyerDetail.title"/></title>
    <meta name="heading" content="<fmt:message key='lawyerDetail.heading'/>"/>
    <script type="text/javascript" src="<c:url value='/scripts/selectbox.js'/>"></script>
</head>

<s:form id="lawyerForm" action="saveLawyer" method="post" validate="true">
    <li style="display: none">
        <s:hidden key="lawyer.sid"/>
    </li>
    <s:textfield key="lawyer.displayName" required="true" maxlength="100" cssClass="text medium"/>
    <s:textfield key="lawyer.email" required="true" maxlength="50" cssClass="text medium"/>
    <s:textfield key="lawyer.firstName" required="true" maxlength="50" cssClass="text medium"/>
    <s:textfield key="lawyer.lastName" required="true" maxlength="50" cssClass="text medium"/>
    <s:textfield key="lawyer.photo" required="false" maxlength="255" cssClass="text medium"/>
    <s:textfield key="lawyer.registrationId" required="false" maxlength="10" cssClass="text medium"/>
    <s:textfield key="lawyer.specialNote" required="false" maxlength="256" cssClass="text medium"/>
    <s:textfield key="lawyer.status" required="false" maxlength="255" cssClass="text medium"/>
    <s:textfield key="lawyer.telephone" required="true" maxlength="10" cssClass="text medium"/>
    
     <li>
        <fieldset>
            <legend><fmt:message key="lawyer.assignPracticeArea"/></legend>
            <table class="pickList">
                <tr>
                    <th class="pickLabel">
                        <label class="required"><fmt:message key="lawyer.availablePracticeAreas"/></label>
                    </th>
                    <td></td>
                    <th class="pickLabel">
                        <label class="required"><fmt:message key="lawyer.practiceAreas"/></label>
                    </th>
                </tr>
                <c:set var="leftList" value="${availablePracticeAreas}" scope="request"/>
                <s:set name="rightList" value="lawyer.practiceAreaList" scope="request"/>
                <c:import url="/WEB-INF/pages/pickList.jsp">
                    <c:param name="listCount" value="1"/>
                    <c:param name="leftId" value="availablePracticeAreas"/>
                    <c:param name="rightId" value="practiceAreas"/>
                </c:import>
            </table>
        </fieldset>
    </li>
    
    <li class="buttonBar bottom">
   		<s:submit key="button.save" method="save" onclick="onFormSubmit(this.form)"/>
       	<c:if test="${not empty lawyer.sid}">
           	<s:submit cssClass="button" method="delete" key="button.delete" onclick="return confirmDelete('Lawyer')" theme="simple"/>
       	</c:if>
       	<s:submit cssClass="button" method="cancel" key="button.cancel" theme="simple"/>
    </li>
</s:form>

<script type="text/javascript">
    Form.focusFirstElement($("lawyerForm"));

    <!-- This is here so we can exclude the selectAll call when roles is hidden -->
    function onFormSubmit(theForm) {
    <c:if test="${param.from == 'list'}">
        selectAll('practiceAreas');
    </c:if>
    }
</script>
